package com.yykj.hospital.server.model.entity.account;

import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.yykj.common.util.serializer.LocalDate2LongSerializer;
import com.yykj.hospital.server.enums.AccountLogType;
import com.yykj.hospital.server.enums.AccountType;
import com.yykj.hospital.server.enums.IncomeExpendType;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.hibernate.annotations.CreationTimestamp;

import javax.persistence.*;
import java.math.BigDecimal;
import java.time.LocalDateTime;

@Data
@Entity
@AllArgsConstructor
@NoArgsConstructor
@Builder
public class AccountSystemLog {
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Integer id;

    @ApiModelProperty("医院ID")
    private Integer hospitalId;

    @ApiModelProperty("医生ID")
    private String doctorId;

    @ApiModelProperty("患者ID")
    private String patientId;

    @ApiModelProperty("订单号")
    private String orderNum;

    @ApiModelProperty("账号日志交易类型")
    @Enumerated(EnumType.STRING)
    private AccountLogType logType;

    @ApiModelProperty("交易金额")
    private BigDecimal price;

    @ApiModelProperty("交易简介")
    private String detail;

    @ApiModelProperty("余额")
    private BigDecimal balance;

    @ApiModelProperty("账号类型")
    @Enumerated(EnumType.STRING)
    private AccountType accountType;

    @ApiModelProperty("收入或者支出")
    @Enumerated(EnumType.STRING)
    private IncomeExpendType incomeExpend;

    @JsonSerialize(using = LocalDate2LongSerializer.class)
    @CreationTimestamp
    @ApiModelProperty("交易时间")
    private LocalDateTime addTime;
}
